package cqrtplm.controller;

import java.math.BigInteger;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ty.basic.response.ResponseResult;
import cqrtplm.constant.RouteConstant;
import cqrtplm.entity.RtCertBaseCertDO;
import cqrtplm.service.RtCertBasecertService;
import cqrtplm.service.RtCfgStatusInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 基础认证Controller
 *
 * @author licong
 * @date 2025-07-29
 */
@RestController
@Api(tags = "认证-基础认证")
@RequestMapping("/rest"+RouteConstant.RATO + "cert/basecert/" + "v1")
public class RtCertBasecertController{
    @Autowired
    private RtCertBasecertService rtCertBasecertService;
    //@Resource
    //private RtCertBasecertService rtCertBasecertService;
    /**
     * 查询基础认证列表
     */
    @PostMapping("/list")
    @ApiOperation(value = "list", notes = "获取列表")
    public ResponseResult list(@RequestBody RtCertBaseCertDO rtCertBasecert)
    {
        List<RtCertBaseCertDO> list = rtCertBasecertService.selectRtCertBasecertList(rtCertBasecert);
        return ResponseResult.success(list);
    }

    @PostMapping("/pagelist")
    @ApiOperation(value = "pagelist", notes = "获取列表")
    public ResponseResult<PageInfo<RtCertBaseCertDO>> pagelist(@RequestBody RtCertBaseCertDO rtCertBasecert,
                                                               @RequestParam(defaultValue = "1") int page,
                                                               @RequestParam(defaultValue = "100") int pageSize
    )
    {
        PageHelper.startPage(page, pageSize);
        List<RtCertBaseCertDO> list = rtCertBasecertService.selectRtCertBasecertList(rtCertBasecert);
        PageInfo<RtCertBaseCertDO> pageInfo =new PageInfo<>(list);
        return ResponseResult.success(pageInfo);
    }

     /**
     * 导出基础认证列表
     */
    @PostMapping("/export")
    public void export(HttpServletResponse response, RtCertBaseCertDO rtCertBasecert)
    {
        List<RtCertBaseCertDO> list = rtCertBasecertService.selectRtCertBasecertList(rtCertBasecert);

        //ExcelUtil.listToExcel(list,RtCertBaseCertDO.class,wwb,"基础认证数据");
    }

    /**
     * 获取基础认证详细信息
     */
    @GetMapping(value = "/{id}")
    @ResponseBody
    public ResponseResult getInfo(@PathVariable("id") String id)
    {
        return ResponseResult.success(rtCertBasecertService.selectRtCertBasecertById(id));
    }

    /**
     * 新增基础认证
     */

    @PostMapping("/add")
    @ResponseBody
    private ResponseResult insertRtCertBasecert(@RequestBody RtCertBaseCertDO rtCertBasecert) {
        return ResponseResult.success(rtCertBasecertService.insertRtCertBasecert(rtCertBasecert));
    }
    /**
     * 修改基础认证
     */

    @PostMapping("/edit")
    public ResponseResult edit(@RequestBody RtCertBaseCertDO rtCertBasecert)
    {
        return ResponseResult.success(rtCertBasecertService.updateRtCertBasecert(rtCertBasecert));
    }

    /**
     * 删除基础认证
     */

    @DeleteMapping("/del")
    public ResponseResult remove(@RequestBody List<String> ids)
    {
        return ResponseResult.success(rtCertBasecertService.deleteRtCertBasecertByIds(ids));
    }
}

